package com.dgut.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dgut.dto.StatisticAO;
import com.dgut.pojo.UserInfo;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.omg.CORBA.UnknownUserException;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface UserInfoMapper extends BaseMapper<UserInfo> {
    //查询没有进行填报的人员名单
    @Select("select name,gender,department,classname,username,identity_category,school_location from userinfo u inner join account a on a.account_id=u.account_id" +
            " where u.account_id not in (select account_id from dailyform where DATE_FORMAT(create_time,'%Y-%m-%d')=#{date}) and u.account_id!=25 and ${ew.sqlSegment}")
    public List<UserInfo> getNoFillList(Page page, @Param(Constants.WRAPPER) Wrapper wrapper,@Param("date") String date);

    //查询用户的基本信息
    @Select("select u.*,username from userinfo u inner join account a on u.account_id=a.account_id ${ew.customSqlSegment}")
    public List<UserInfo> getUserInfoList(Page page, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("select * from userinfo where account_id=#{id}")
    public UserInfo selectUserInfoByAccountId(int id);
}
